//
//  BottomContainerView.swift
//  APP
//
//  Created by LXF on 2018/1/22.
//  Copyright © 2018年 Rdxer. All rights reserved.
//

import UIKit

class BottomContainerView: UIVisualEffectView {
    
    public var bottomHeight:CGFloat = 49
    /// 容器 view
    let containerView = UIView.init()
    
    public init(height:CGFloat = 49,style:UIBlurEffectStyle = UIBlurEffectStyle.light) {
        let blur = UIBlurEffect.init(style: style)
        super.init(effect: blur)
        self.bottomHeight = height
        prepareBottomButton()
    }
    
    public required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        prepareBottomButton()
    }
    
    func prepareBottomButton(){
        contentView.xx_Add(divider: .top, dividerColor: AC.grayDividerColor, dividerWidth: 1)
        
    }

    open func addTo(_ view:UIView){
        view.addSubview(self)
        layoutWithSuperview()
    }
    open func layoutWithSuperview(){
        contentView.addSubviews([containerView])
        
        snp.makeConstraints { (make) in
            make.bottom.left.right.equalToSuperview()
            make.height.equalTo(XXConstant.tabbarHeigh)
        }
        
        containerView.snp.makeConstraints { (make) in
            make.top.right.left.equalToSuperview()
            make.height.equalTo(bottomHeight)
        }
    }
}
